<!-- 表单弹窗 -->
<form id="cmsarticle-form" lay-filter="cmsarticle-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    <div class="layui-form-item">
        <label class="layui-form-label">栏目标号</label>
        <div class="layui-input-block">
            <input name="categoryIds" placeholder="请输入栏目标号" type="text" class="layui-input" maxlength="20"  id="categoryIds"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input name="articleDataId" placeholder="请输入" type="text" class="layui-input" maxlength="20"  id="articleDataId"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input name="title" placeholder="请输入标题" type="text" class="layui-input" maxlength="20"  id="title"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">链接</label>
        <div class="layui-input-block">
            <input name="link" placeholder="请输入链接" type="text" class="layui-input" maxlength="20"  id="link"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题颜色</label>
        <div class="layui-input-block">
            <input name="titleColor" placeholder="请输入标题颜色" type="text" class="layui-input" maxlength="20"  id="titleColor"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">关键字</label>
        <div class="layui-input-block">
            <input name="keywords" placeholder="请输入关键字" type="text" class="layui-input" maxlength="20"  id="keywords"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述、摘要</label>
        <div class="layui-input-block">
            <input name="description" placeholder="请输入描述、摘要" type="text" class="layui-input" maxlength="20"  id="description"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权重，越大越靠前</label>
        <div class="layui-input-block">
            <input name="weight" placeholder="请输入权重，越大越靠前" type="text" class="layui-input" maxlength="20"  id="weight"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权重期限</label>
        <div class="layui-input-block">
            <input name="weightDate" placeholder="请输入权重期限" type="text" class="layui-input" maxlength="20"  id="weightDate"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">点击数</label>
        <div class="layui-input-block">
            <input name="hits" placeholder="请输入点击数" type="text" class="layui-input" maxlength="20"  id="hits"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建者</label>
        <div class="layui-input-block">
            <input name="createBy" placeholder="请输入创建者" type="text" class="layui-input" maxlength="20"  id="createBy"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <input name="createDate" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createDate"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">更新者</label>
        <div class="layui-input-block">
            <input name="updateBy" placeholder="请输入更新者" type="text" class="layui-input" maxlength="20"  id="updateBy"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">更新时间</label>
        <div class="layui-input-block">
            <input name="updateDate" placeholder="请输入更新时间" type="text" class="layui-input" maxlength="20"  id="updateDate"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注信息</label>
        <div class="layui-input-block">
            <input name="remarks" placeholder="请输入备注信息" type="text" class="layui-input" maxlength="20"  id="remarks"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">删除标记  0--未删除，1--删除</label>
        <div class="layui-input-block">
            <input name="delFlag" placeholder="请输入删除标记  0--未删除，1--删除" type="text" class="layui-input" maxlength="20"  id="delFlag"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属单位</label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入所属单位" type="text" class="layui-input" maxlength="20"  id="businessId"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input name="image" placeholder="请输入" type="text" class="layui-input" maxlength="20"  id="image"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">点赞</label>
        <div class="layui-input-block">
            <input name="praised" placeholder="请输入点赞" type="text" class="layui-input" maxlength="20"  id="praised"
                   lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;

        var cmsarticle = admin.getTempData('t_cmsarticle');
        if (cmsarticle.method=="update"){
            form.val('cmsarticle-form', cmsarticle);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
            layer.load(2);

            admin.req('sys/agreearticle/'+cmsarticle.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");
            return false;
        });
    });
</script>
